package com.nervenets.web.controller.handler.user.help;

import com.nervenets.web.controller.handler.Handler;
import com.nervenets.web.controller.handler.common.EmptyParams;
import com.nervenets.web.redis.domain.global.GlobalRule;
import lombok.Data;

import javax.servlet.http.HttpServletRequest;

public class InvoiceInfoGetHandler extends Handler<EmptyParams> {
    @Override
    public String handle(EmptyParams params, HttpServletRequest request) throws Exception {
        final GlobalRule globalRule = globalVariablesService.getGlobalRule();
        Model model = new Model();
        model.setInvoiceType(globalRule.getInvoiceType());
        model.setInvoiceCompany(globalRule.getInvoiceCompany());
        model.setInvoiceNo(globalRule.getInvoiceNo());
        model.setInvoiceExAddress(globalRule.getInvoiceExAddress());
        model.setInvoiceExTel(globalRule.getInvoiceExTel());
        model.setInvoiceExZipCode(globalRule.getInvoiceExZipCode());
        return successMessage(model);
    }

    @Override
    public String result() throws Exception {
        return successMessage(new Model());
    }

    @Data
    class Model {
        private String invoiceType = "企业单位";//发票抬头类型
        private String invoiceCompany = "四川视纪网络科技有限公司";//发票抬头
        private String invoiceNo = "91510105MA6B588J35";//发票税号
        private String invoiceExAddress = "四川省成都市武候区望江路1号中海广场1306";//公司收件人地址
        private String invoiceExTel = "02885081413";//公司收件人电话
        private String invoiceExZipCode = "610000";//公司收件邮编
    }
}
